#include <ros/ros.h>
#include "learn_topic_userdef/Product.h"

class User {
 public:
  User() {
    sub_ = nh_.subscribe("product_info", 10, &User::MsgCallback, this);
  }

  ~User() {

  }

  static void Init(int argc, char** argv) {
    ros::init(argc, argv, "product_subscriber");
  }

 private:
  ros::NodeHandle nh_;
  ros::Subscriber sub_;

  void MsgCallback(const learn_topic_userdef::Product::ConstPtr& msg) {
    ROS_INFO("Subscribe product info: name:%s,type:%d,function:%s",
      msg->name.c_str(), msg->type, msg->function.c_str());
  }
};

int main(int argc, char** argv) {
  User::Init(argc, argv);

  User techfan;

  ros::spin();


  return 0;
}
